package name.sraynal.howmanydays;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.Calendar;

public class HowManyDays {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		new HowManyDays().execute();
	}

	private void execute() throws IOException {
		Calendar firstSeptember = Calendar.getInstance();
		firstSeptember.set(2009, Calendar.SEPTEMBER, 1);
		int remainingDays = firstSeptember.get(Calendar.DAY_OF_YEAR)
							- Calendar.getInstance().get(Calendar.DAY_OF_YEAR);
		File output = new File("C:\\temp\\temp-counter.htm");
		Writer writer = new FileWriter(output);
		writer.append("<html>\n<style>\nbody {\nfont-size:70;\ntext-align:center;\n}")
			.append("\n</style>\n<body>\n<br><br>Encore ");
		writer.append(new Integer(remainingDays).toString());
		writer.append(" jours :-)</body></html>");
		writer.close();
		Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe \""
														+ output.getAbsolutePath() + "\"");
	}

}
